package bean;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="district")
public class District implements java.io.Serializable{
	@Id
	@Column(name="ID")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer districtId;
	@Column(name="NAME")
	private String name;
	@OneToMany
	@JoinColumn(name="DISTRICT_ID")
	@Cascade(value={CascadeType.ALL})
	private Set<Street> streets = new HashSet<Street>();
	
	public District() {
		super();
	}
	public Integer getDistrictId() {
		return districtId;
	}
	public void setDistrictId(Integer districtId) {
		this.districtId = districtId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Set<Street> getStreets() {
		return streets;
	}
	public void setStreets(Set<Street> streets) {
		this.streets = streets;
	}
	@Override
	public String toString() {
		return "District [districtId=" + districtId + ", name=" + name + ", streets=" + streets + "]";
	}
}

